package com.bonana.core.result;

import org.springframework.context.support.MessageSourceAccessor;

/**
 * Created by xiabin on 2016/8/17.
 */
public enum ResponseCode {
    ERROR(-1),
    MISSING_PARAMETER(-2),
    USERNAME_PASSWORD_ERROR(-3),
    USER_DISABLED(-4),
    ITEM_NOT_FOUND(-5),
    ALREADY_EXIST(-6),
    USER_NOT_LOGIN(-7),
    ALREADY_FOLLOWED(-8),
    ALREADY_LIKED(-9),
    PASSWORD_INCORRECT(-10),
    USER_NOT_FOUND(-11),
    SUCC_BOBOUSER(3),
    SUCC_PARTNER(2),
    SUCC_ADMIN(1),
    SUCC(0),
    ;

    public Integer getResultCode() {
        return resultCode;
    }

    public void setResultCode(Integer resultCode) {
        this.resultCode = resultCode;
    }

    public String getResultMsg() {
        return resultMsg;
    }

    public void setResultMsg(String resultMsg) {
        this.resultMsg = resultMsg;
    }

    public Object[] getArgs() {
        return args;
    }

    public ResponseCode setArgs(Object[] args) {
        this.args = args;
        resultMsg = ResponseMessageSource.getAccessor().getMessage(this.name(), args, "");
        return this;
    }

    private ResponseCode(Integer rCode) {
        resultCode = rCode;
        resultMsg = ResponseMessageSource.getAccessor().getMessage(this.name(),"");
    }

    Integer resultCode;
    String resultMsg;
    Object[] args;
}
